package com.giao.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

@Entity
@Data
public class User {
    @Id
    private Integer id;
    private String name;
    private Integer age;

    @ManyToMany
    @JsonIgnoreProperties(value = { "roleList" })
    @JoinTable(name = "user_role_relation",joinColumns ={ @JoinColumn(name="user_id")},
            inverseJoinColumns = {@JoinColumn(name = "role_id")})
    private List<Role> roleList;

}
